<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="../00.插件/babel.min.js"></script>
  <script src="../00.插件/react.development.js"></script>
  <script src="../00.插件/react-dom.development.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/babel">

  class Parent extends React.Component {

    oIpt = React.createRef()

    render() {
      return (
        <div>
          <input type="text" ref={this.oIpt}/>
          <button onClick={this.handler}>获取input内容</button>
        </div>
      )
    }

    handler = () => {
      console.log(this)
      console.log(this.oIpt)
      const {value} = this.oIpt.current
      console.log(value)
    }

  }


  const root = ReactDOM.createRoot(document.getElementById('app')).render(<Parent/>)
</script>
</body>
</html>